import { BaseSkill } from '../BaseSkill';
import { DamageType, SkillType } from '../../types';
import { General } from '../../models/General';
import { Battle } from '../../models/Battle';

export class MouLue extends BaseSkill {
  private readonly INTELLIGENCE_REDUCTION = 0.3;

  constructor() {
    super(
      'mouLue',
      '谋略',
      SkillType.Active,
      DamageType.Strategy,
      0.7,
      4,
      2
    );
  }

  execute(source: General, battle: Battle): void {
    if (!this.canUse() || Math.random() > this.probability) return;

    const target = battle.getRandomEnemy(source);
    if (!target) return;

    // 添加智力降低效果
    target.addEffect({
      type: 'intelligenceReduce',
      value: target.attributes.intelligence * this.INTELLIGENCE_REDUCTION,
      duration: this.duration,
      stackable: false,
      source: this.id,
      timestamp: Date.now()
    });

    this.startCooldown();
  }
}
